import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:getwidget/components/avatar/gf_avatar.dart';
import 'package:getwidget/components/radio_list_tile/gf_radio_list_tile.dart';
import 'package:getwidget/types/gf_radio_type.dart';

import '../controllers/gfradiolisttile_controller.dart';

class GfradiolisttileView extends GetView<GfradiolisttileController> {
  String flutterPath = 'assets/images/flutter.jpg';
  String avatarPath = 'assets/images/cliu.jpg';
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('单选框列表'),
        centerTitle: true,
      ),
      body: Container(
        child: Obx(() {
          return ListView(
            children: [
              GFRadioListTile(
                titleText: '初六',
                subTitleText: '懂二进制的男人',
                avatar: GFAvatar(
                  backgroundImage: AssetImage(avatarPath),
                ),
                size: 25,
                activeBorderColor: Colors.green,
                focusColor: Colors.green,
                type: GFRadioType.basic,
                groupValue: controller.groupValue.value,
                onChanged: (value) {
                  controller.groupValue.value = value;
                },
                value: 0,
                inactiveIcon: null,
              ),
              GFRadioListTile(
                titleText: 'Flutter',
                subTitleText: '跨端开发框架',
                avatar: GFAvatar(
                  backgroundImage: AssetImage(flutterPath),
                ),
                size: 25,
                activeBorderColor: Colors.green,
                focusColor: Colors.green,
                type: GFRadioType.basic,
                value: 1,
                groupValue: controller.groupValue.value,
                onChanged: (value) {
                  controller.groupValue.value = value;
                },
                inactiveIcon: null,
              ),
            ],
          );
        })
      ),
    );
  }
}
